package com.inibb.app.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name = "GOODS_PIC_REF")
public class GoodsPicRef implements java.io.Serializable{

	private static final long serialVersionUID = 1L;
	private Integer goodsPicRefId;
	private Integer goodsId;
	private Goods goods;
	private Integer picId;
	private Pic pic;
	private String mainInd;

	@Id
	@Column(name = "GOODS_PIC_REF_ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@OrderBy("ASC")
	public Integer getGoodsPicRefId() {
		return goodsPicRefId;
	}

	public void setGoodsPicRefId(Integer id) {
		this.goodsPicRefId = id;
	}
	
	@Column( name="GOODS_ID", length=POConstants.ID_FIELD_LENGTH )
	public Integer getGoodsId() {
		return goodsId;
	}
	public void setGoodsId(Integer goodsId) {
		this.goodsId = goodsId;
	}
	@Column( name="PIC_ID", length=POConstants.ID_FIELD_LENGTH )
	public Integer getPicId() {
		return picId;
	}
	public void setPicId(Integer picId) {
		this.picId = picId;
	}
	@Column( name="MAIN_IND", length=POConstants.IND_LENGTH )
	public String getMainInd() {
		return mainInd;
	}
	public void setMainInd(String mainInd) {
		this.mainInd = mainInd;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="GOODS_ID",insertable=false,updatable=false)
	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="PIC_ID",insertable=false,updatable=false)
	public Pic getPic() {
		return pic;
	}

	public void setPic(Pic pic) {
		this.pic = pic;
	}
	
	
}
